<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,viewport-fit=cover,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
    <title>尤迈桃李会</title>
    <script src="js/rem.js"></script>
    <link rel="stylesheet" href="css/weui.min.css">
    <link rel="stylesheet" href="css/jquery-weui.min.css">
    <link rel="stylesheet" href="css/public.css">
    <link rel="stylesheet" href="css/index.css">
    <script>(function() {var _53code = document.createElement("script");_53code.src = "https://tb.53kf.com/code/code/96d8f960b261e49515450f8953b044bc5/1";var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(_53code, s);})();</script>
</head>
<body>
    <div class="login-wrapper plr15">
        <div class="find-pass1">
            <div class="tit">绑定手机号</div>
            <ul class="list">
                <li><input id="phoneInput" class="input" type="text" placeholder="请输入注册手机号"></li>
                <li class="flex-btw">
                    <input class="input" name="checkCode" type="text" placeholder="请输入手机验证码">
                    <span class="get-code-btn" id="getCodeBth">获取验证码</span>
                </li>
            </ul>
            <input class="pub-submit-btn pass-conf-btn" type="button" value="绑定">
        </div>
    </div>
    <script src="js/jquery-3.6.0.min.js"></script>
    <script src="js/jquery-weui.min.js"></script>
    <script src="js/md5.js"></script>
    <script src="js/public.js"></script>
    <script>
        $('.find-pass1 .pass-conf-btn').click(function(){
            var phone = $.trim($('#phoneInput').val());
            var checkCode = $.trim($('[name=checkCode]').val());
            if(validEmpty(phone, '手机号不能为空')) return false;
            if(validEmpty(checkCode, '验证码不能为空')) return false;
            http('/user/addUserLogin', {
                hasToken: false,
                loading: true,
                data: {
                    checkCode: checkCode,
                    loginMobile: phone,
                    openid: getQueryString('openid')
                },
                success: function(res){
                    if(res.code === '01'){
                        toast('绑定手机号成功');
                        setCookie('token', res.data.token);
                        setCookie('userId', res.data.userId, 1);
                        localStorage.setItem("mobile", phone);
                        setTimeout(function(){
                            window.location.replace('login-pass-set.html');
                        }, 1000);
                    }else if(res.code === '05'){
                        setCookie('token', res.data.token);
                        setCookie('userId', res.data.userId, 1);
                        localStorage.setItem("mobile", res.data.loginMobile);
                        backIndex(1000);
                    }
                }
            })
        })

        // 发送验证码
        var sendStatus = false;
        $('#getCodeBth').click(function(){
            if(sendStatus) return false;
            var phone = $.trim($('#phoneInput').val());
            if(validEmpty(phone, '手机号不能为空')) return fasle;
            sendStatus = true;
            getCode($(this), phone, 'vxRegist');
        })
    </script>
</body>
</html>